home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / TinyGL / ami / content / ad709 / tinygl / examples / asm / basicframework.asm < prev    next >
Encoding:
Assembly Source File  |  2002-08-20  |  2.1 KB  |  82 lines

  1. .include 'tao'
  2.  
  3. ; Include the TinyGL asm stuff
  4. .include 'ad709/tinygl/glut'
  5.  
  6.  
  7. tool 'ami/content/ad709/tinygl/examples/asm/basicframework', VP, F_MAIN, 8192, 0
  8. ent (- : -)
  9.     regdef pointer glutFuncs   
  10.     regdef pointer gluFuncs
  11.     regdef pointer glutLib
  12.     regdef pointer glFuncs
  13.     regdef pointer glLib
  14.     regdef pointer gluLib
  15.     regdef pointer argv
  16.     regdef int argc
  17.     regdef int glutWindow
  18.     regdef pointer vendor
  19.  
  20.     qcall lib/argcargv, (- : argv, argc)
  21.  
  22.     ; Get the pointers to the GL function table and GL lib handle
  23.     qcall ami/lib/ad709/tinygl/init, (GL_LIB : glFuncs, glLib)
  24.  
  25.     ; Get the pointers to the GL function table and GL lib handle
  26.     qcall ami/lib/ad709/tinygl/init, (GLUT_LIB : glutFuncs, glutLib)
  27.     
  28.     qcall ami/lib/ad709/tinygl/init, (GLU_LIB : gluFuncs, gluLib)
  29.  
  30.     ; Copy the pointers obtained above into a global area using GL and GLUT macros
  31.     cpy.p glFuncs, GL
  32.     cpy.p glutFuncs, GLUT    
  33.     cpy.p gluFuncs, GLU    
  34.  
  35.     ; Call GLUT and GL functions using the glXXXXX macros to get the sub-routine pointer
  36.     gos glutInit(GLUT), (argc, argv : -)
  37.     gos glutInitWindowSize(GLUT), (320, 240 : -)
  38.     gos glutInitWindowPosition(GLUT), (0, 0 : -)
  39.     __string 'Basic OpenGL app'
  40.     gos glutCreateWindow(GLUT), (__string_param.p : glutWindow)
  41.  
  42.     ; For demonstration purposes, the init procedure is defined in a seperate tool.
  43.     ; The GL macro ensures the seperate tool can still find the functions table
  44.     qcall ami/content/ad709/tinygl/examples/asm/basicframework_init, (- : -)
  45.     gos glutDisplayFunc(GLUT), (display.p : -)
  46.     gos glutIdleFunc(GLUT), (idle.p : -)  
  47.     gos gluLookAt(GLU), (0, 0, 0, 0, 0, 0, 0, 1, 0 : -)    
  48.     gos glutMainLoop(GLUT), (- : -)
  49.  
  50.     qcall ami/lib/ad709/tinygl/deinit, (glFuncs, glLib : -)
  51.     qcall ami/lib/ad709/tinygl/deinit, (glutFuncs, glutLib : -)
  52.      qcall ami/lib/ad709/tinygl/deinit, (gluFuncs, gluLib : -)
  53.     
  54.     ret ()
  55. entend
  56.  
  57.  
  58. display:
  59. ent (- : -)
  60.     gos glClear(GL), (GL_COLOR_BUFFER_BIT : -)
  61.     ret ()
  62. entend
  63.  
  64.  
  65. idle:
  66. ent (- : -)
  67.     gos glutPostRedisplay(GLUT), (- : -)
  68.     ret ()
  69. entend
  70.  
  71. toolend
  72.  
  73.  
  74. tool 'ami/content/ad709/tinygl/examples/asm/basicframework_init', VP
  75. ent (- : -)
  76.     gos glClearColor(GL), (0, 0, 0, 0 : -)
  77.     gos glClear(GL), (GL_COLOR_BUFFER_BIT : -)
  78.     ret ()
  79. entend
  80.  
  81. toolend
  82.